package Model2;
import Model2.User;
import Model2.HotelRoom;
import Model2.PricingStrategy;
import Model2.FullPriceStrategy;
import Model2.GoldCardDiscountStrategy;
import Model2.SilverCardDiscountStrategy;
import Model2.NormalUser;
import Model2.GoldCardUser;
import Model2.SilverCardUser;
// 测试类
public class StrategyPatternExample {
    public static void main(String[] args) {
        // 创建用户
        User normalUser = new NormalUser(1, "Alice");
        User goldCardUser = new GoldCardUser(2, "Bob");
        User silverCardUser = new SilverCardUser(3, "Charlie");

        // 创建房间
        HotelRoom room = new HotelRoom(101, "Deluxe Room", 200.0);

        // 创建定价策略
        PricingStrategy fullPriceStrategy = new FullPriceStrategy();
        PricingStrategy goldCardStrategy = new GoldCardDiscountStrategy();
        PricingStrategy silverCardStrategy = new SilverCardDiscountStrategy();

        // 计算最终价格
        double normalPrice = room.calculateFinalPrice(normalUser, fullPriceStrategy);
        double goldCardPrice = room.calculateFinalPrice(goldCardUser, goldCardStrategy);
        double silverCardPrice = room.calculateFinalPrice(silverCardUser, silverCardStrategy);

        // 输出结果
        System.out.println("Normal User Price: " + normalPrice);
        System.out.println("Gold Card User Price: " + goldCardPrice);
        System.out.println("Silver Card User Price: " + silverCardPrice);
    }
}